var Promission = function(){
	

	function getCombData() {
	var zoneRadioPanel = null;   
    //  实例化   
    zoneRadioPanel = new Ext.Panel({   
        	id:'zoneRadioPanel',   
        	title:'地市:',   
        	border:true,   
        	width:265,   
        	height:150,   
        	defaults:{columnWidth: '.3'},   
    	    layout:'column'  
	    }); 
	var dataStr = "["; 
		Ext.Ajax.request({ 
			url : '../UserManagement/QueryUser.form?timesnap' + new Date().getTime(), 
				success : function(response, options) {
				//alert(Ext.util.JSON.encode(options));
				
				//alert(Ext.util.JSON.decode(response).result);
				//alert(Ext.util.JSON.decode(response.responseText).result);
				//alert(Ext.util.JSON.encode(Ext.util.JSON.decode(response.responseText).result.length));
			//	alert(Ext.util.JSON.encode(Ext.util.JSON.decode(response.responseText).result[0].USERNAME));
			/**	alert(resultArr[0].USERNAME);
				 var radio = new Ext.form.Radio({   
            	boxLabel:'<font size=2>'+zoneInfoArray[i].AREA_NAME+'</font>',   
            	inputValue:zoneInfoArray[i].AREA_ID,   
            	name:'areaRadioGroup',   
            	checked: (0 == i) ? true : false  
            	
            	for (var i = 0; i < count; i++) { 
					dataStr = dataStr + "{boxLabel: '" + Ext.util.JSON.encode(Ext.util.JSON.decode(response.responseText).result[i].USERNAME) + "'}"; 
					var d = (i == (count - 1)) ? "]" : ","; 
					dataStr = dataStr + d; 
					} 
					alert(dataStr); 
					return dataStr; 
            	
            	var radio = new Ext.form.Radio({   
			            boxLabel:'<font size=2>'+Ext.util.JSON.decode(response.responseText).result[i].USERNAME+'</font>',   
			            inputValue:Ext.util.JSON.decode(response.responseText).result[i].ID,   
			            name:'areaRadioGroup',   
			            checked: (0 == i) ? true : false  
			        });   
			        zoneRadioPanel.add(radio);
            	
        });**/
        		var resultArr = Ext.util.JSON.encode(Ext.util.JSON.decode(response.responseText).result);//.root;
				var count=Ext.util.JSON.decode(response.responseText).result.length;
				
				//alert(Ext.util.JSON.decode(response.responseText).result[1].ID);
				for (var i = 0; i < count; i++) { 
					dataStr = dataStr + "{boxLabel: '" + Ext.util.JSON.encode(Ext.util.JSON.decode(response.responseText).result[i].USERNAME) + "'}"; 
					var d = (i == (count - 1)) ? "]" : ","; 
					dataStr = dataStr + d; 
					alert(dataStr); 
					}
					return dataStr;
					
					 
					//alert(dataStr); 
					//return dataStr; 
				} 
			}); 
	}; 
	







var createInfoStore = new Ext.data.JsonStore(
			{url : '../pact/searchPact.form?timesnap=' + new Date().getTime(),
				root : 'result',
				fields : ['DEPARTMENT_ID', 'DEPARTMENT_NAME','ID'],
				listeners : {
					scope : this,
					beforeload : function(thiz) {
						thiz.baseParams = {
						};
					}
				}
	});
	
	var	zoneRadioPanel = new Ext.Panel({   
						        id:'zoneRadioPanel',   
						        title:'地市:',   
						        border:true,   
						        width:400,   
						        height:200,   
						        defaults:{columnWidth: '.3'},   
						        layout:'column'  
						    });
	

var searchArea = new Ext.form.ComboBox( {
		fieldLabel : '所属区域',
		store: createInfoStore,
		mode : 'local',
		displayField : 'DEPARTMENT_NAME',
		triggerAction : 'all',
		editable : false,
		valueField : 'DEPARTMENT_ID',
		typeAhead : true,
		width : 150,
		emptyText : '---请选择---',
		selectOnFocus : true
	});
	
var zoneInfoArray = createInfoStore.items;

  
 //   if(null == records || 0 == records.length){   
 //       alert('注意', '加载地域信息失败,请联系管理员!');   
 //       return;   
 //   }   
    //  声明地域zoneRadioPanel   
    
   //  实例化   
 /**
createInfoStore.on('load', function(zoneStore, records, options){   

	 var	zoneRadioPanel = new Ext.Panel({   
						        id:'zoneRadioPanel',   
						        title:'地市:',   
						        border:true,   
						        width:265,   
						        height:150,   
						        defaults:{columnWidth: '.3'},   
						        layout:'column'  
						    });
		var zoneInfoArray = records.items;	
	  
						    //  根据地域信息创造地域radio面板   
						    for(var i = 0; i < zoneInfoArray.length; i++){      
						        var radio = new Ext.form.Radio({   
						            boxLabel:'<font size=2>'+zoneInfoArray[i].AREA_NAME+'</font>',   
						            inputValue:zoneInfoArray[i].AREA_ID,   
						            name:'areaRadioGroup',   
						            checked: (0 == i) ? true : false  
						        });   
						        zoneRadioPanel.add(radio); }
						        }); 
		
		
		 for(var i = 0; i < StoreCount; i++){      
							        var radio = new Ext.form.Radio({   
							            boxLabel:'<font size=2>'+'test'+'</font>',   
							            inputValue: 1 ,   
							            name:'areaRadioGroup',   
							            checked: (0 == i) ? true : false  
							        });   
							        zoneRadioPanel.add(radio); }
		
	**/		    


	this.createPromission = new Ext.form.FormPanel({
		frame : true,
		width : 800,
		fileUpload: true, 
		labelWidth : 85,
		buttons : [
		           {text:'确认',icon: '../resources/icons/add.png',scope:this,handler:function()
		           		{	
	           			 	getCombData();	 
		           			
		           		}
		           	},
		          
		           	{text:'重置',icon: '../resources/icons/cross.png',scope:this,handler:function()
		           		{	}
		           		}
		           ],
		           
		items : [{layout:'column',defaults:{layout:'form'},
			      items:[zoneRadioPanel]
				}],

	   listeners: {
	    	render: {fn:function(){ 
		     //      createInfoStore.load();
		     getCombData();
		           for(var i = 0; i <= 3; i++){      
						        var radio = new Ext.form.Radio({   
						            boxLabel:'<font size=2>'+"测试"+'</font>',   
						            inputValue:"10",   
						            name:'areaRadioGroup',   
						            checked: (0 == i) ? true : false  
						        });
			}}
		}
		}
	});
	
	
	
 

	
	

};